-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: add doom loop detection #3445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I don't know if we should do model specific because there are other models too kimi-k2, supernova, gemini models all can get to that state, peoplee can also define model aliases too hard to catch them all. What if we just do a check when a also I think the "error message" should probably be the same for all the llms is there any reason for a different message per model? I don't know if it will matter substantially in this case What do you think? |
…sion-based approach
|
Updated to universal doom loop detection. Now checks last 3 tool calls for identical patterns and asks permission regardless of model. |
|
hm that one is harder to catch, I think this current pr will be a good start and we will see how it performs for other cases |
|




fix: add loop detection for doom loop models (GLM-4.6, Grok Code)
GLM-4.6 and Grok Code models are prone to "doom loops" - infinite repetition of same tool call with identical parameters. This causes wasted tokens, poor user experience with stuck sessions, and server resource waste.
This commit adds targeted loop detection that monitors tool calls for problematic models and injects breaking messages when loops are detected. The implementation uses Map-based counting with O(1) performance and only affects specific models known to have this issue.
Key changes:
DOOM_LOOP_MODELSconstant for model-specific configuration (glm-4.6, grok-code)Fixes infinite loop issue while maintaining performance and extensibility for additional problematic models.
fixes: #3444